package com.gitee.xhs.sampleSource;

import com.gitee.xhs.sampleRecod.transactionRecord.Transaction;
import com.gitee.xhs.sampleRecod.transactionRecord.TransactionIterator;
import com.gitee.xhs.sourceIterator.AbstractRateLimitedIterator;
import com.gitee.xhs.sourceIterator.RateLimitedIterator;
import org.apache.flink.streaming.api.functions.source.FromIteratorFunction;

import java.util.Iterator;

/**
 * @author BigHead
 * @date 2022/6/28 17:17
 * @description 有界TransactionSource 间隔1S生成工具类
 */
public class TransactionUnBoundOneSecondSource extends FromIteratorFunction<Transaction> {

    private static final long serialVersionUID = 1L;

    public TransactionUnBoundOneSecondSource() {
        super(new RateLimitedIterator<>(TransactionIterator.defaultFiveLoopUnbounded()));
    }

    public TransactionUnBoundOneSecondSource(Iterator<Transaction> iterator){
        super(iterator);
    }

}
